#ifndef __STORMWIDGET_CONFIGMANAGE_CSINGLETHREAD_SINGLETHREAD_H
#define __STORMWIDGET_CONFIGMANAGE_CSINGLETHREAD_SINGLETHREAD_H

class CSingleThread
{
public:
	CSingleThread(void);
	virtual ~CSingleThread(void);
	BOOL Create(BOOL bTerminateIfExists);
	virtual UINT __stdcall DefThreadProc() = 0;
	void DestroyThread();
	BOOL PostMessage(UINT msg, WPARAM wParam, LPARAM lParam);
	BOOL IfActive();
	BOOL IfAbort();
	__inline HANDLE GetHandle() { return m_hThread; }
	__inline DWORD GetThreadID() { return m_dwThreadID; }
protected:
	static UINT __stdcall ThreadProc(LPVOID lpParam);
protected:
	HANDLE m_hStartEvent;
	HANDLE m_hThread;
	DWORD m_dwThreadID;
	BOOL  m_bAbort;
};
#endif //__STORMWIDGET_CONFIGMANAGE_CSINGLETHREAD_SINGLETHREAD_H
